<?php

if ((!defined('CMS_SYSTEM')) AND (!defined('CMS_ADMIN'))) { die('Stop!!!'); }

function url_sid($s,$act="")
{
	global $f, $do, $rewrite_mod;

	$urlin = array(
	"'search.php'",
	"'(?<!/)index.php'",
	"'(?<!/)index.html\?f=survey&do=result&id=([a-zA-Z0-9]*)&vote=([0-9]*)'",
	"'(?<!/)index.html\?f=articles&do=page&artid=([a-zA-Z0-9]*)&page=([0-9]*)'",
	"'(?<!/)index.html\?f=([a-zA-Z]*)&do=categories&catid=([0-9]*)&page=([0-9]*)'",
	"'(?<!/)index.html\?f=([a-zA-Z]*)&do=categories&catid=([0-9]*)'",
	"'(?<!/)index.html\?f=([a-zA-Z]*)&do=([a-zA-Z]*)&id=([a-zA-Z0-9]*)'",
	"'(?<!/)index.html\?f=([a-zA-Z]*)&do=([a-zA-Z]*)'",
	"'(?<!/)index.html\?f=([a-zA-Z]*)&page=([0-9]*)'",
	"'(?<!/)index.html\?f=([a-zA-Z]*)'"
	);

	$urlout = array(
	"search",
	"index.html",
	"survey_result_\\1_\\2.html",
	"articles_page_\\1_\\2.html",
	"\\1_chanel_\\2_\\3.html",
	"\\1_chanel_\\2.html",
	"\\1_\\2_\\3.html",
	"\\1_\\2.html",
	"\\1_\\2.html",
	"\\1.html"
	);

	if($rewrite_mod == 1) {
		if($act == 1 || ($act != 1 && !defined('CMS_ADMIN'))) {
			$s = preg_replace($urlin, $urlout, $s);
		}
	}
	return $s;

}

?>